'''
被控主程序: 但他实际上是客户端程序, 是反射型shell
'''

import socket

server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)

host = '0.0.0.0' # 获取本地主机名
port = 12345                # 设置端口
server.bind((host, port))        # 绑定端口
server.listen(5)                 # 等待客户端连接
sentData = 0
server.setblocking(True)
link,addr = server.accept()


while True:


    print('client is', addr)
    print(server.recv(1024).decode())



link.close()
# while True:
    
#     link,addr = server.accept()     # 建立客户端连接
#     print('client is', addr)
#     link.send(str(sentData).encode())
#     sentData += 1
#     link.close()                # 关闭连接